/*
 * CarTest.java
 * JMUnit based test
 *
 * Created on Apr 29, 2012, 1:13:55 AM
 */
package Car;

import Point.Point;
import jmunit.framework.cldc10.AssertionFailedException;
import jmunit.framework.cldc10.TestCase;

/**
 * @author Christianto
 */
public class CarTest extends TestCase {
    
    public CarTest() {
        //The first parameter of inherited constructor is the number of test cases
        super(5, "CarTest");
    }    
    
    public void test(int testNumber) throws Throwable {
        switch (testNumber) {
            case 0:
                testGetPos();
                break;
            case 1:
                testUpdate();
                break;
            case 2:
                testSetVel();
                break;
            case 3:
                testGetVel();
                break;
            case 4:
                testSetPos();
                break;
            default:
                break;
        }
    }

    /**
     * Test of testGetPos method, of class Car.
     */
    public void testGetPos() throws AssertionFailedException {
        System.out.println("getPos");
        Point expResult_1 = new Point(15.0,8.0);        
        Car instance = new Car(expResult_1, 0);
        Point result_1 = instance.getPos();
        assertEquals(expResult_1, result_1);
    }

    /**
     * Test of testUpdate method, of class Car.
     */
    public void testUpdate() throws AssertionFailedException {
        System.out.println("Update");
        Point Position = new Point(15.0,8.0);
        double Velocity = 15.0;
        Car instance = new Car(Position, Velocity);

        Point expResult_1 = new Point(15.0,8.0 + 15.0 / 100.0);          
        double dt_1 = 10.0;
        instance.Update(dt_1);
        Point result_1 = instance.getPos();       
        assertEquals(expResult_1, result_1);
    }

    /**
     * Test of testSetVel method, of class Car.
     */
    public void testSetVel() throws AssertionFailedException {
        System.out.println("SetVel");
        Car instance = new Car();
        double expResult_1 = 5.0;
        instance.SetVel(expResult_1);
        double result_1 = instance.getVel();
        assertTrue(expResult_1 == result_1);
    }

    /**
     * Test of testGetVel method, of class Car.
     */
    public void testGetVel() throws AssertionFailedException {
        System.out.println("getVel");
        Car instance = new Car(5.0);
        double expResult_1 = 5.0;
        double result_1 = instance.getVel();
        assertTrue(expResult_1 == result_1);
    }

    /**
     * Test of testSetPos method, of class Car.
     */
    public void testSetPos() throws AssertionFailedException {
        System.out.println("SetPos");
        Car instance = new Car();
        Point expResult_1 = new Point(15.0,8.0);  
        instance.SetPos(expResult_1); 
        Point result_1 = instance.getPos();
        assertEquals(expResult_1, result_1);
    }
}
